﻿using ChongJu.ModelManager.Alarm;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;
using System.Windows.Media.Imaging;

namespace ChoJu.Converters.Uc
{
    class AlarmTypeConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            string ico = "pack://application:,,,/Public.ResourceBase;component/images/button/alarmerror.png";

            var val = (AlarmEnum)value;
            switch (val)
            {
                case AlarmEnum.Error: ico = "pack://application:,,,/Public.ResourceBase;component/images/button/alarmerror.png"; break;
                case AlarmEnum.Warning: ico = "pack://application:,,,/Public.ResourceBase;component/images/button/alarmwarn.png"; break;
                case AlarmEnum.Normal: ico = "pack://application:,,,/Public.ResourceBase;component/images/button/alarmtip.png"; break;
            }

            return new BitmapImage(new Uri(ico));
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
